In [1]:
# import zipimport
# ok_bundle =  zipimport.zipimporter('./ok').load_module('client')
# ok = ok_bundle.api.notebook.Notebook('ipy.ok')

Hosted Settings:

In a hosted environment such as jupyterhub:

  • run pip install okpy>=1.8.2 --upgrade

Local Setting

For Local Dev:

  • run jupyter notebook from the root ok-client folder

Running from a distributed ok file

import zipimport
ok_bundle =  zipimport.zipimporter('./ok').load_module('client')
ok = ok_bundle.api.notebook.Notebook('ipy.ok')

In [2]:
from client.api.notebook import Notebook
ok = Notebook('ipy.ok')


=====================================================================
Assignment: California Water Usage
OK, version v1.8.1
=====================================================================


In [3]:
ok.auth(force=True)


Copy the following URL and open it in a web browser. To copy,
highlight the URL, right-click, and select "Copy".

https://okpy.org/client/login/

After logging in, copy the code from the web page and paste it below.
To paste, right-click and select "Paste".

Paste your code here: asdv
---------------------------------------------------------------------
Authentication error: invalid grant
---------------------------------------------------------------------

Part 1: Maps

The districts and zips data sets are Map objects. Documentation on mapping in the datascience package can be found at data8.org/datascience/maps.html. To view a map of California's water districts, run the cell below. Click on a district to see its description.

Question 2.1. Assign the name income_by_zipcode to a table with just one row per ZIP code. When you group according to ZIP code, the remaining columns should be summed. In other words, for any other column such as 'N02650', the value of 'N02650' in a row corresponding to ZIP code 90210 (for example) should be the sum of the values of 'N02650' in the 6 rows of income_raw corresponding to ZIP code 90210.


In [4]:
all_cities = [1, 2]

In [5]:
_ = ok.grade('q01')
_ = ok.submit()


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running tests

---------------------------------------------------------------------
Test summary
    Passed: 1
    Failed: 0
[ooooooooook] 100.0% passed

Submit... 100% complete
Submission successful for user: sumukh@berkeley.edu
URL: https://okpy.org/ok/test/su16/ex/submissions/eV4yZ5

Question 3.1. Some stufff


In [ ]:
_ = ok.grade('q02')  
_ = ok.backup()

In [ ]:


In [ ]:
ok.submit()